Mongodb查询重复数据 脚本 db.storageFile.aggregate( { '$group': { '_id': { 'md5': '$md5' }, 'uniqueIds': { '$addToSet': '$_id' }, 'count': { '$sum': 1 } } }, { '$match': { 'count': { '$gt': 1 } } } )